Remove class component from ReportActionsList#16613
Conversation
| // This is a workaround to a reanimated issue -> https://github.com/software-mansion/react-native-reanimated/issues/3355 | ||
| if (process.browser) { | ||
| // eslint-disable-next-line no-underscore-dangle | ||
| window._frameTimestamp = null; | ||
| } |
There was a problem hiding this comment.
It looks like software-mansion/react-native-reanimated#3355 was fixed in software-mansion/react-native-reanimated@2fd0da8 which was released in 3.0.0, however you're still using 3.0.0-rc.10. It's okay to keep this workaround as for now but once you upgrade to 3.0.0+ (currently the latest version is 3.0.2) you should be safe to get rid of it.
There was a problem hiding this comment.
Hey there :-)
Using reanimated@3.0.2 I still seem to have this problem with next.js unfortunately.
next.js version is 12.1.5
The workaround from above still seems to work.
ReportActionsList
|
Had some time to test this one so taking it out of draft. |
| // Workaround to a reanimated issue -> https://github.com/software-mansion/react-native-reanimated/issues/3355 | ||
| // We can remove it as soon as we are on > reanimated 3.0.0+ | ||
| if (process.browser) { | ||
| // eslint-disable-next-line no-underscore-dangle | ||
| window._frameTimestamp = null; | ||
| } | ||
|
|
There was a problem hiding this comment.
Shouldn't this workaround be used in a Top Level since we may need it for other components too.
There was a problem hiding this comment.
Good point. I think it can.
| function keyExtractor(item) { | ||
| return item.reportActionID; | ||
| } |
There was a problem hiding this comment.
Why this function is defined outside ReportActionsList Wouldn't it be better to define it inside and useCallback with empty dependency array.
There was a problem hiding this comment.
We had some conversation here about it: https://expensify.slack.com/archives/C01GTK53T8Q/p1680096510744619
I don't have a strong preference though and just going with what we decided there. Can you think of some different or better arguments on why to do what you suggest?
There was a problem hiding this comment.
Just thought that since keyExtractor was a part of the class component it should still be a part of the functional component but maybe having that function a part of the class component was a "mistake" in the first place.
I think having the function defined outside is slightly better e.g. If we render 100 instances of that component all will use the same function, where if we defined it inside each will use it's own function (100 functions that are all the same).
Reviewer Checklist
Screenshots/Videos |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/marcaaron in version: 1.3.0-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.0-2 🚀
|






Details
Refactors the
ReportActionsListto use React Hooks.Fixed Issues
$ #16266
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android